/**
 * Scalog - Scalog is a logging framework for the Scala programming language.
 * Copyright (C) 2009  Laurent Grangier
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package net.scalog.standard;

import StandardLevel._
import net.scalog.Logging
import net.scalog.Logger

/**
 * Mixin for all classes which wants to add logging facilities with the standard type of messages.
 * 
 * @author Laurent Grangier
 */
trait StandardLogging extends Logging with StandardLoggerIncluder {
  
  /**
   * Logs the message at the TRACE level.
   * 
   * @param message the log message
   */
  def trace(message : => Any) : Unit = trace(message, null);
  
  /**
   * Logs the message and the throwable at the TRACE level.
   * 
   * @param message the log message
   * @param throwable the throwable to log
   */
  def trace(message : => Any, throwable : Throwable) : Unit = log(message, throwable, TRACE);
  
  /**
   * Logs the message at the DEBUG level.
   * 
   * @param message the log message
   */
  def debug(message : => Any) : Unit = debug(message, null);
  
  /**
   * Logs the message and the throwable at the DEBUG level.
   * 
   * @param message the log message
   * @param throwable the throwable to log
   */
  def debug(message : => Any, throwable : Throwable) : Unit = log(message, throwable, DEBUG);
  
  /**
   * Logs the message at the INFO level.
   * 
   * @param message the log message
   */
  def info(message : => Any) : Unit = info(message, null);
  
  /**
   * Logs the message and the throwable at the INFO level.
   * 
   * @param message the log message
   * @param throwable the throwable to log
   */
  def info(message : => Any, throwable : Throwable) : Unit = log(message, throwable, INFO);
  
  /**
   * Logs the message at the WARN level.
   * 
   * @param message the log message
   */
  def warn(message : => Any) : Unit = warn(message, null);
  
  /**
   * Logs the message and the throwable at the WARN level.
   * 
   * @param message the log message
   * @param throwable the throwable to log
   */
  def warn(message : => Any, throwable : Throwable) : Unit = log(message, throwable, WARN);
  
  /**
   * Logs the message at the ERROR level.
   * 
   * @param message the log message
   */
  def error(message : => Any) : Unit = error(message, null);
  
  /**
   * Logs the message and the throwable at the ERROR level.
   * 
   * @param message the log message
   * @param throwable the throwable to log
   */
  def error(message : => Any, throwable : Throwable) : Unit = log(message, throwable, ERROR);
  
  /**
   * Logs the message at the FATAL level.
   * 
   * @param message the log message
   */
  def fatal(message : => Any) : Unit = fatal(message, null);
  
  /**
   * Logs the message and the throwable at the FATAL level.
   * 
   * @param message the log message
   * @param throwable the throwable to log
   */
  def fatal(message : => Any, throwable : Throwable) : Unit = log(message, throwable, FATAL);
  
}
